package com.smedi.ismedi.inmail.core.application.service;

import com.smedi.ismedi.file.dto.response.FileInfoResponse;
import com.smedi.ismedi.inmail.core.application.command.*;
import com.smedi.ismedi.inmail.core.domain.aggregatemodel.Attachment;
import com.smedi.ismedi.inmail.core.domain.aggregatemodel.announcement.Announcement;
import com.smedi.ismedi.inmail.core.domain.aggregatemodel.announcement.AttachmentKeyAndTime;
import com.smedi.ismedi.inmail.core.domain.dto.ReadRecord;

import java.io.IOException;
import java.util.List;

/**
 * 通知公告应用服务接口
 *
 * @author jiangqinxuan
 * @date 2021/07/26
 */
public interface AnnouncementApplicationService {

    /**
     * 新建 通知公告
     *
     * @param announcementCreateCommand 通知公告 新建 命令
     * @return Announcement
     */
    Announcement createAnnouncement(AnnouncementCreateCommand announcementCreateCommand);   
    
    /**
     * 编辑 通知公告
     *
     * @param announcementEditCommand 通知公告 编辑 命令
     * @return Announcement
     */
    Announcement editAnnouncement(AnnouncementEditCommand announcementEditCommand);

    /**
     * 审核 通知公告
     *
     * @param announcementReviewCommand 通知公告 审核 命令
     * @return Announcement
     */
    Announcement reviewAnnouncement(AnnouncementReviewCommand announcementReviewCommand);
    
    /**
     * 失效 通知公告
     *
     * @param announcementDisableCommand 通知公告 失效 命令
     * @return Announcement
     */
    Announcement disableAnnouncement(AnnouncementDisableCommand announcementDisableCommand);

    /**
     * 删除 通知公告
     *
     * @param announcementRemoveCommand 通知公告 删除 命令
     * @return Announcement
     */
    void removeAnnouncement(AnnouncementRemoveCommand announcementRemoveCommand);

    /**
     * 查看 通知公告
     *
     * @param announcementReadCommand 查看 通知公告 命令
     * @return Announcement
     */
    Announcement readAnnouncement(AnnouncementReadCommand announcementReadCommand);

    /**
     * 通过压缩包下载
     *
     * @param attachmentKeyList 附件key
     * @return byte[]
     */
    byte[] downloadFilesToZip(List<String> attachmentKeyList) throws IOException;

    /**
     * 通过压缩包下载-指定文件名
     *
     * @param attachmentKeyAndTimeList 附件与发布时间
     * @return byte[]
     */
    FileInfoResponse postDownloadFilesSetNameToZip(List<AttachmentKeyAndTime> attachmentKeyAndTimeList) throws IOException;


    /**
     * 导出流转单
     *
     * @param announcementReadRecordCommand 流转单 导出 命令
     * @return Page<AnnouncementManagementQueryVo>
     */
    void updateReadRecord(AnnouncementReadRecordCommand announcementReadRecordCommand) throws IOException;

    /**
     * 更新 流转单
     *
     * @param readRecordOneQueryCommand 流转单 更新 命令
     * @return url
     */
    Attachment getReadRecordOne(ReadRecordOneQueryCommand readRecordOneQueryCommand) throws IOException;

    /**
     * 导出 流转单
     *
     * @param readRecordAllZipQueryCommand 流转单 更新 命令
     * @return ReadRecord
     */
    ReadRecord getAllReadRecordZip(ReadRecordAllZipQueryCommand readRecordAllZipQueryCommand);

    /**
     * 导出 通知公告
     *
     * @param announcements 通知公告
     * @return ReadRecord
     */
    String exportAnnouncement(List<Announcement> announcements);
}
